{include file="common/header"}
<div id="app" v-cloak>
	<el-curd
    	ref="curd"
		:field="field"
        :table-sort="{prop: 'create_time', order: 'desc'}"
        table-operation-width="130px"
        :table-selection="false">
	    <template v-slot:operation="row">
            <a href="javascript:;" @click="openData(row, ['message'], '备注', 'shop/lottery/message')">备注</a>
            <a 
                href="javascript:;"
                v-if="row.lottery_type == 3"
                @click="openData(row, ['shipping_code', 'shipping_company_code'], '发货', 'shop/lottery/deliverGoods')">
                {{row.shipping_code == '' ? '发货' : '配送信息'}}
            </a>
        </template>
	</el-curd>
</div>
<script>
	new Vue({
		el: "#app",
		data() {
			return {
				field: [
					{
						prop: 'id',
						label: '编号',
						table: {sort: true},
						form: false
					},
					{
                        prop: 'user', 
                        label: '用户信息',
                        table: {
                            is: 'object', 
                            child: ['email','mobile'],
                            sort: true
                        },
                        form: false,
                    },
					{
						prop: 'lottery_cover',
						label: '奖品图片',
						table: {
						    is: 'el-image',
							sort: true,
						},
						form: false
					},
					{
						prop: 'lottery_title',
						label: '奖品名称',
						table: {
							sort: true,
						},
						form: false
					},
					{
						prop: 'create_time',
						label: '抽奖时间',
						table: {
							sort: true,
						},
						form: false
					},
					{
						prop: 'receiver',
						label: '收货信息',
						table: {
							sort: true,
						},
						form: false
					},
					{
						prop: 'message',
						label: '备注',
						table: {
							sort: true,
						},
						form: {
    						type: 'textarea'  
						},
					},
					{
						prop: 'shipping_company_code',
						label: '快递公司',
						table: false,
						form: {
						    is: 'el-input',
						    rules: [
								{required: true, message: '请输入'},
							],
						}
					},
					{
						prop: 'shipping_code',
						label: '快递单号',
						table: false,
						form: {
						    is: 'el-input',
						    rules: [
								{required: true, message: '请输入'},
							],
						}
					},
				],
			}
		},
		methods: {
		    // 打开数据
            openData(row, appoint, title = '', drawerSave = true) {
                this.$refs.curd.openData(row, appoint, title, drawerSave);
            },
		}
	})
</script>
{include file="common/footer"}